package com.example.idachuappone.person.entity;

import com.example.idachuappone.cook.entity.CookResult;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;

public class Order implements Serializable {
    private String area;
    private String community;
    private String date;
    private String dateline;
    private String door_number;
    private String id;
    private int ingredient;
    private String is_commented;
    private CookResult kitchener;
    private String lat;
    private String lng;
    private String memo;
    private String name;
    private String package_id;
    private String package_name;
    private String package_price;
    private String pay_price;
    private String pay_status;
    private String pay_type;
    private String phone;
    private List<OrderPriceItem> price_item;
    private QuanResults quanResults;
    private String status;

    public Order parseJson(JSONObject json) {
        if (json == null) {
            return null;
        }
        if (json.has("id")) {
            this.id = json.optString("id");
        }
        if (json.has("name")) {
            this.name = json.optString("name");
        }
        if (json.has("phone")) {
            this.phone = json.optString("phone");
        }
        if (json.has("area")) {
            this.area = json.optString("area");
        }
        if (json.has("community")) {
            this.community = json.optString("community");
        }
        if (json.has("door_number")) {
            this.door_number = json.optString("door_number");
        }
        if (json.has("lng")) {
            this.lng = json.optString("lng");
        }
        if (json.has("lat")) {
            this.lat = json.optString("lat");
        }
        if (json.has("package_id")) {
            this.package_id = json.optString("package_id");
        }
        if (json.has("package_name")) {
            this.package_name = json.optString("package_name");
        }
        if (json.has("package_price")) {
            this.package_price = json.optString("package_price");
        }
        if (json.has("date")) {
            this.date = json.optString("date");
        }
        if (json.has("memo")) {
            this.memo = json.optString("memo");
        }
        if (json.has("ingredient")) {
            this.ingredient = json.optInt("ingredient");
        }
        if (json.has("kitchener")) {
            JSONObject jsonObject = json.optJSONObject("kitchener");
            this.kitchener = new CookResult();
            this.kitchener = this.kitchener.parseJson(jsonObject);
        }
        if (json.has("pay_type")) {
            this.pay_type = json.optString("pay_type");
        }
        if (json.has("pay_price")) {
            this.pay_price = json.optString("pay_price");
        }
        if (json.has("pay_status")) {
            this.pay_status = json.optString("pay_status");
        }
        if (json.has("status")) {
            this.status = json.optString("status");
        }
        if (json.has("is_commented")) {
            this.is_commented = json.optString("is_commented");
        }
        if (json.has("dateline")) {
            this.dateline = json.optString("dateline");
        }
        if (json.has("coupon")) {
            this.quanResults = new QuanResults();
            this.quanResults.parseJson(json.optJSONObject("coupon"));
        }
        if (!json.has("price_item")) {
            return this;
        }
        this.price_item = new ArrayList();
        JSONArray jsonArray = json.optJSONArray("price_item");
        if (jsonArray == null || jsonArray.length() <= 0) {
            return this;
        }
        for (int i = 0; i < jsonArray.length(); i++) {
            OrderPriceItem orderPriceItem = new OrderPriceItem();
            orderPriceItem.parseJson(jsonArray.optJSONObject(i));
            this.price_item.add(orderPriceItem);
        }
        return this;
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public int getIngredient() {
        return this.ingredient;
    }

    public void setIngredient(int ingredient) {
        this.ingredient = ingredient;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return this.phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getArea() {
        return this.area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getCommunity() {
        return this.community;
    }

    public void setCommunity(String community) {
        this.community = community;
    }

    public String getDoor_number() {
        return this.door_number;
    }

    public void setDoor_number(String door_number) {
        this.door_number = door_number;
    }

    public String getLng() {
        return this.lng;
    }

    public void setLng(String lng) {
        this.lng = lng;
    }

    public String getLat() {
        return this.lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public String getPackage_id() {
        return this.package_id;
    }

    public void setPackage_id(String package_id) {
        this.package_id = package_id;
    }

    public String getPackage_name() {
        return this.package_name;
    }

    public void setPackage_name(String package_name) {
        this.package_name = package_name;
    }

    public String getPackage_price() {
        return this.package_price;
    }

    public void setPackage_price(String package_price) {
        this.package_price = package_price;
    }

    public String getDate() {
        return this.date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getMemo() {
        return this.memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public String getPay_type() {
        return this.pay_type;
    }

    public void setPay_type(String pay_type) {
        this.pay_type = pay_type;
    }

    public String getPay_price() {
        return this.pay_price;
    }

    public void setPay_price(String pay_price) {
        this.pay_price = pay_price;
    }

    public String getPay_status() {
        return this.pay_status;
    }

    public void setPay_status(String pay_status) {
        this.pay_status = pay_status;
    }

    public String getStatus() {
        return this.status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getDateline() {
        return this.dateline;
    }

    public void setDateline(String dateline) {
        this.dateline = dateline;
    }

    public String getIs_commented() {
        return this.is_commented;
    }

    public void setIs_commented(String is_commented) {
        this.is_commented = is_commented;
    }

    public CookResult getKitchener() {
        return this.kitchener;
    }

    public void setKitchener(CookResult kitchener) {
        this.kitchener = kitchener;
    }

    public QuanResults getQuanResults() {
        return this.quanResults;
    }

    public void setQuanResults(QuanResults quanResults) {
        this.quanResults = quanResults;
    }

    public List<OrderPriceItem> getPrice_item() {
        return this.price_item;
    }

    public void setPrice_item(List<OrderPriceItem> price_item) {
        this.price_item = price_item;
    }
}
